import UserLayout from "@/layouts/UserLayout";
import Login from "@/pages/User/Login";
import Register from "@/pages/User/Register";
import RegisterResult from "@/pages/User/RegisterResult";

import BasicLayout from "@/layouts/BasicLayout";
import Analysis from "@/pages/Dashboard/Analysis";
import Monitor from "@/pages/Dashboard/Monitor";


import Page404 from '@/pages/404';

import Authorized from '@/pages/Authorized';
import Center from "../pages/Account/Center/Center";
import Articles from "../pages/Account/Center/Articles";
import Info from "../pages/Account/Settings/Info";
import BaseView from "../pages/Account/Settings/BaseView";
import SecurityView from "../pages/Account/Settings/SecurityView";
import Map from "../pages/Map/index";
import DeviceSetting from "../pages/Device/Manage";

import Mileage from "../pages/Report/Mileage";
import Run from "../pages/Report/Run";
import Speed from "../pages/Report/Speed";
import Stay from "../pages/Report/Stay";
import Error from "../pages/Report/Error";
import MyMap from "../pages/MyMap/index";
// import MyRail from "../pages/MyTrail/index";

import MyDashboard from '../pages/MyDashboard/Analysis'
import MyDevice from '../pages/MyDevice/Manage'
import MyMileage from "../pages/MyReport/Mileage";
const routes = [
  // user
  {
    path: '/user',
    component: UserLayout,
    routes: [
      {path: '/user', redirect: '/user/login', exact: true,},
      {path: '/user/login', component: Login},
      {path: '/user/register', component: Register},
      {path: '/user/register-result', component: RegisterResult},
    ],
  },
  // {
  //   path:'/rail',
  //   component:MyRail
  // },
  // app
  {
    path: '/',
    component: BasicLayout,
    Routes: [Authorized],
    authority: ['admin', 'user'],
    routes: [
      {path: '/', redirect: '/dashboard/analysis', exact: true},
      {
        path: '/dashboard',
        name: 'dashboard',
        icon: 'dashboard',
        component: MyDashboard,
      },
      {
        name: 'map',
        path: '/map',
        icon: 'environment',
        component: MyMap,
      },
      {
        name: 'cy',
        path: '/cy',
        icon: 'environment',
        component: DeviceSetting,
      },
      {
        name: 'cy',
        path: '/cy1',
        icon: 'environment',
        component: Map,
      },
      {
        path: '/report',
        icon: 'table',
        name: 'report',
        routes: [
          {
            path: '/report/mileage',
            name: 'mileage',
            component: MyMileage,
          },
          {
            path: '/report/stay',
            name: 'stay',
            component: Stay,
          },
          {

            path: '/report/run',
            name: 'run',
            component: Run,
          },
          {
            path: '/report/speed',
            name: 'speed',
            component: Speed,
          },
          {
            path: '/report/error',
            name: 'error',
            component: Error,
          },
        ],
      },
      {
        name: 'device.settings',
        icon: 'setting',
        path: '/device',
        component: MyDevice,
      },
      {
        name: 'account.settings',
        icon: 'user',
        path: '/account',
        hideInMenu: true,
        routes: [

          {
            path: '/account/settings',
            name: 'settings',
            component: Info,
            routes: [
              {
                path: '/account/settings/base',
                component: BaseView,
              },
              {
                path: '/account/settings/security',
                component: SecurityView,
              },
            ]
          },

        ],
      },
      {
        component: Page404,
      },
    ]
  },


];


export default routes;
